//
//  AboutDealsCell.m
//  欢乐美食
//
//  Created by 遇水 on 15/6/29.
//  Copyright (c) 2015年 遇水. All rights reserved.
//

#import "AboutDealsCell.h"
#import "UIImageView+WebCache.h"

@interface AboutDealsCell ()
@property (weak, nonatomic) IBOutlet UIImageView *ImageVeiw;  //图片显示
@property (weak, nonatomic) IBOutlet UILabel *BusinessName;    //店铺名称

@property (weak, nonatomic) IBOutlet UILabel *dealType;    //团购类型

@property (weak, nonatomic) IBOutlet UILabel *Newpice;    //团购现价

@property (weak, nonatomic) IBOutlet UILabel *oldPice;   //团购原价

@property (weak, nonatomic) IBOutlet UILabel *Dealnumber;  //团购已售出

@end

@implementation AboutDealsCell


-(void)setDeal:(MSDeals *)deal
{
    _deal = deal;
    //设置控件的值
    [self.ImageVeiw sd_setImageWithURL:[NSURL URLWithString:deal.image_url]];
    self.BusinessName.text = deal.title;
//    self.dealType.text = ;
    self.Newpice.text = [self NumberFromNSString:deal.current_price];
    
    NSString *str = [self NumberFromNSString:deal.list_price];
    str = [str stringByAppendingString:@"元"];
    
    
    self.oldPice.text = str;
    self.dealType.text =[deal.categories firstObject];
    
    NSString *number = @"已售:";
    number = [number stringByAppendingString:[self NumberFromNSString:deal.purchase_count]];
    
    
    self.Dealnumber.text =  number;
    
    
    
    
}

-(NSString *)NumberFromNSString:(NSNumber *)number
{
    NSNumberFormatter *fortter = [[NSNumberFormatter alloc]init];
    
   return [fortter stringFromNumber:number];
}


@end
